import request from '@/common/js/request/request.js';

export const api = {
	/**
	 * get请求
	 * @param {Object} url
	 * @param {Object} data
	 */
	get(url, data) {
		return request.request({
			url: url,
			method: 'GET',
			data
		})
	},
	/**
	 * post请求
	 * @param {Object} url
	 * @param {Object} data
	 */
	post(url, data) {
		return request.request({
			url: url,
			method: 'POST',
			data
		})
	},
	/**
	 * put请求
	 * @param {Object} url
	 * @param {Object} data
	 */
	put(url, data) {
		return request.request({
			url: url,
			method: 'PUT',
			data
		})
	},
	/**
	 * delete请求
	 * @param {Object} url
	 * @param {Object} data
	 */
	delete(url, data) {
		return request.request({
			url: url,
			method: 'DELETE',
			data
		})
	},
	/**
	 * 自定义请求
	 * @param {Object} method
	 * @param {Object} url
	 * @param {Object} data
	 */
	request(method, url, data) {
		return request.request({
			url: url,
			method: method,
			data
		})
	},
}

// 默认全部导出  
export default api
